package bancosys.tec.services.api;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;
import bancosys.tec.exception.MessageCreatorHelper;

/**
 * @author lundberg
 */
public enum ServiceMessages implements MessageCreator {

    XLS_CHARACTER_LIMIT_OVERFLOW(3, "bancosys.tec.services.input.driver.XLSServiceWriter.xls.character.limit.overflow");

    public static final String DEFAULT_BUNDLE = "jmine-tec-services-messages";

    private final MessageCreator delegate;

    /**
     * Construtor
     * 
     * @param nargs nargs
     * @param key key
     */
    private ServiceMessages(int nargs, String key) {
        this(DEFAULT_BUNDLE, key, nargs);
    }

    /**
     * Construtor
     * 
     * @param bundle bundle
     * @param key key
     * @param nargs nargs
     */
    private ServiceMessages(String bundle, String key, int nargs) {
        this.delegate = MessageCreatorHelper.creator(bundle, key, nargs);
    }

    /**
     * {@inheritDoc}
     */
    public LocalizedMessageHolder create(Object... arguments) {
        return this.delegate.create(arguments);
    }

    /**
     * {@inheritDoc}
     */
    public int getExpectedArguments() {
        return this.delegate.getExpectedArguments();
    }

}
